//获得所属用户角色名
function getTypeName_1(name) {
    if(name==0){
        return "个人";
    }else if(name==1){
        return "公司";
    }else if(name==2){
        return "管理员"
    }
}
//获得权限名
function getTypeName_2(name) {
    if(name==1001){
        return "算法";
    }else if(name==1002){
        return "模型";
    }else if(name==1003){
        return "任务";
    }else if(name==1004){
        return "管理";
    }else if(name==1005){
        return "远程部署";
    }else if(name==1006){
        return "调度";
    }else if(name==1007){
    	return "运行监控";
    }
}

window.onload = function() {
    var index = parent.layer.getFrameIndex(window.name);
    var url = window.location.search;//你的地址

    if (url.indexOf("?") != -1) {
        var str = url.substr(1)
        strs = str.split("&");
        var page = strs[0].split("=")[1];
    }
    console.log(page);
    $.ajax({
        url: constUrl + "UserServlet",
        type: 'post',
        data: {
            operateType: "showDetail",
            userId: page
        },
        dataType: 'json',
        success: function (responseText) {
            console.log(responseText);
            //console.log(9999);
            /*$("#u_name").val(responseText.datas[0].userName);
            $("#u_password").val(responseText.datas[0].userPassword);
            $("#u_affiliation").val(responseText.datas[0].userAffiliation);
            $("#u_classification").val(getTypeName_1(responseText.datas[0].userRole));
            $("#u_email").val(responseText.datas[0].userEmail);*/

            var detailHTML = '<tr id="u_name" ><td>用户名：</td><td>'+responseText.datas[0].userName+'</td></tr>' +
                             '<tr id="u_affiliation" ><td>所属机构：</td><td>'+responseText.datas[0].companyName+'</td></tr>' +
                             '<tr id="u_role" ><td>用户角色：</td><td>'+responseText.datas[0].roleName+'</td></tr>' +
                             '<tr id="u_email" ><td>联系方式：</td><td>'+responseText.datas[0].userEmail+'</td></tr>'
            $("#userdetail").html(detailHTML);

        },
        complete: function () {
        },
        error: function () {
        }
    });
}
